﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bary</title>
<link rel="stylesheet" type="text/css" id="css" href="Resource/css/main.css">


<link rel="stylesheet" type="text/css" href="Resource/yui/build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="Resource/yui/build/logger/assets/skins/sam/logger.css" />
<link rel="stylesheet" type="text/css" href="Resource/yui/build/datatable/assets/skins/sam/datatable.css" />
<script type="text/javascript" src="Resource/yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="Resource/yui/build/connection/connection-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/logger/logger-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/json/json-min.js"></script>
<script type="text/javascript" src="Resource/yui/build/element/element.js"></script>
<script type="text/javascript" src="Resource/yui/build/datasource/datasource.js"></script>
<script type="text/javascript" src="Resource/yui/build/datatable/datatable.js"></script>
<script type="text/javascript" src="Resource/yui/build/utilities/utilities.js"></script>


<%
	String goodId = (String)request.getParameter("good_id");
	//out.print(goodId);
%>

<body id="yahoo-com" class=" yui-skin-sam">
	<div id="framed">
  	<h2>版色管理</h2>
  </div>
  
  <div>

<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->

<div id="demo">
    <div id="paging"></div>
    <div id="dt"></div>
    <br />
    <div id="function"><input type="button" value="管理版色套图" onclick="onSelectRow()" /> &nbsp;<input type="button" value="管理库存" onclick="manageHold()" /> &nbsp;<input type="button" value="新增版色" onclick="newSubColor()" /> &nbsp;<input type="button" value="返回" onclick="returnUpper()" /></div>
</div>


<script type="text/javascript">
var myDataTable = null;
YAHOO.util.Event.onDOMReady(function () {
    	
    	  var DataSource = YAHOO.util.DataSource,
        DataTable  = YAHOO.widget.DataTable,
        Paginator  = YAHOO.widget.Paginator;
        

       

        var myDataSource = new DataSource("listSubColorInit.do?");
        myDataSource.responseType = DataSource.TYPE_JSON;
        myDataSource.responseSchema = {
        		resultsList :"returnObj",  
            fields: ["good_id","color_id","color_name","prd_color_pic","prd_list_pic","prd_check_pic","prd_order_pic",],
            metaFields: {totalRecords: "totalRecords" }     
        };

			

		
		    var myTableConfig = {
		        initialRequest         : 'goodId=<%=goodId%>'
		       
		    };
		    
		    var myColumnDefs = [
            {key:"good_id",label:"商品编号"},
            {key:"color_id",label:"版色编号"},
            {key:"color_name",label:"版色名称"},
            {key:"prd_color_pic",label:"产品版色图"},
            {key:"prd_list_pic",label:"产品陈列图"},
            {key:"prd_check_pic",label:"购物结算图"},
            {key:"prd_order_pic",label:"产品排序图"}
        ];
				
        myDataTable = new DataTable("dt", myColumnDefs, myDataSource, myTableConfig);

				myDataTable.subscribe("rowMouseoverEvent", myDataTable.onEventHighlightRow);   
	      myDataTable.subscribe("rowMouseoutEvent", myDataTable.onEventUnhighlightRow);   
	      myDataTable.subscribe("rowClickEvent", myDataTable.onEventSelectRow);   
            

       
});

function onSelectRow(){
					var rows =  myDataTable.getSelectedRows();
					var record = myDataTable.getRecord(rows[0]);
					location.href = "manageSuitPic.do?good_id="+record.getData("good_id")+"&color_id="+record.getData("color_id");
}

function returnUpper(){
			location.href = "goodList.do";
}


function newSubColor(){
		location.href = "addSubColor.do?good_id=<%=goodId%>"
}

function manageHold(){
	var rows =  myDataTable.getSelectedRows();
					var record = myDataTable.getRecord(rows[0]);
					location.href = "manageHold.do?good_id="+record.getData("good_id")+"&color_id="+record.getData("color_id");
}
</script>

<!--END SOURCE CODE FOR EXAMPLE =============================== -->

  </div>
  
  <p><a href="#" id="loglink">Click here</a> to log a simple message.</p> 
  
  <script language="javascript">
  	
  	YAHOO.example.Basic = new function() {
    YAHOO.util.Event.addListener(YAHOO.util.Dom.get("loglink"), "click", function(e) {
        YAHOO.util.Event.stopEvent(e);
        YAHOO.log("This is a simple log message.");
    });

    // Put a LogReader on your page
    this.myLogReader = new YAHOO.widget.LogReader();
};


  	</script>
		
</body>
</html>